import pandas as pd
import plotly.graph_objects as go
import plotly.express as px
# 表示  express
import plotly


# filename='D:\\py\\data\\1962_2006_walmart_store_openings.csv'
# filename='1962_2006_walmart_store_openings.csv'
# filename=r"G:\file\学校\可视化\大作业\COVID-19\COVID-19-Data-master\US\County_level_summary\US_County_summary_covid19_confirmed.csv"
filename=r"G:\file\学校\可视化\大作业\COVID-19\COVID-19-Data-master\US\County_level_summary\US_County_summary_covid19_confirmed_transpose.csv"
df = pd.read_csv(filename)
# walmart_loc_df.head()
#Plot the scatter plot
# df=df[[df.iloc[1],df.iloc[1]]]
# print("df")
# print(df)
# df 隔几行 选一行
# https://www.cnblogs.com/everfight/p/create_dataframe_from_different_type.html
# rows=[]
# # 遍历的只是 标签吗
# for row in df:
#     rows.append(row)
# print("rows")
# print(rows)
def get_sel_rows(row_cnt,step,start_from):
    sel_rows=[]
    for i in range(start_from,row_cnt+start_from+1):
        sel_rows.append(i*step)
    return sel_rows

step=4
row_cnt=10
start_from=40
# sel_rows=[]
# for i in range(1,row_cnt+1):
#     sel_rows.append(i*step)
    # i*4
sel_rows=get_sel_rows(row_cnt,step,start_from)
# print( df.iloc[[1,3,6],[0,2]])
df=df.iloc[sel_rows,:]
# print( df.iloc[sel_rows,:])
print( "df")
print( df)

name_base="US_County_summary_covid19_confirmed_transpose"
# filename=f"{name_base}_row_cnt_{row_cnt}_step_{step}.csv"
filename=f"{name_base}_row_cnt_{row_cnt}_step_{step}_st_fr_{start_from}.xlsx"
# https://blog.csdn.net/wf592523813/article/details/96278289

df.to_excel(filename)



